package com.xs.ai.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import org.hibernate.annotations.Type;
import com.vladmihalcea.hibernate.type.json.JsonType;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

// ==========================================
// 联系人重要性实体
// ==========================================
@Data
@Entity
@Table(name = "contact_importance", 
       uniqueConstraints = @UniqueConstraint(columnNames = {"userId", "contactEmail"}))
public class ContactImportance {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    private Long userId;
    private String contactEmail;
    private String contactName;
    private String contactTitle;
    private String contactCompany;
    
    private Double importanceScore; // 0.00-1.00
    private Integer interactionCount = 0;
    private LocalDateTime lastInteractionAt;
    private Integer avgResponseTimeMinutes;
    
    private String relationshipType; // investor, board_member, key_customer等
    
    @Type(JsonType.class)
    @Column(columnDefinition = "jsonb")
    private List<String> tags;
    
    @Column(columnDefinition = "TEXT")
    private String notes;
    
    // AI学习数据
    private Double emailOpenRate;
    private Double replyRate;
    private Double meetingAcceptRate;
    
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
}